//
//  skillDetaViewController.m
//  LOL_PalmarHelper
//
//  Created by dlios on 15-6-29.
//  Copyright (c) 2015年 hantao. All rights reserved.
//

#import "skillDetaViewController.h"

@interface skillDetaViewController ()

@end

@implementation skillDetaViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    
    self.scrollV = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width,self.view.frame.size.height)];
    self.scrollV.contentSize = CGSizeMake(0,self.view.frame.size.height + self.view.frame.origin.y+140);
    self.scrollV.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.scrollV];
    self.scrollV.delegate = self;
    self.scrollV.bounces = NO;
    
    
    
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, 5, 150, 40)];
    self.nameLabel.font = [UIFont systemFontOfSize:20.0];
    self.nameLabel.backgroundColor = [UIColor clearColor];
    [self.scrollV addSubview:self.nameLabel];
    self.nameLabel.text = self.mySkill.name;
    [_nameLabel release];
    
    
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"上一页" style:UIBarButtonItemStyleDone target:self action:@selector(action)];
    
    
    [self.navigationItem.leftBarButtonItem release];
    
    
    
    self.myImageV = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 90,90 )];
    self.myImageV.backgroundColor = [UIColor cyanColor];
    self.myImageV.image = [UIImage imageNamed:self.mySkill.imageName];
    [self.scrollV addSubview:self.myImageV];
    [_myImageV release];
 
    self.rankLabel1  = [[UILabel alloc] initWithFrame:CGRectMake(120, 40, 70, 40)];
    self.rankLabel1.backgroundColor = [UIColor clearColor];
    self.rankLabel1.text = @"需要等级";
    self.rankLabel1.font = [UIFont systemFontOfSize:16];
    [self.rankLabel1 setTextColor:[UIColor lightGrayColor]];
    [self.scrollV addSubview:self.rankLabel1];
    [_rankLabel1 release];
    
    self.rankLabel  = [[UILabel alloc] initWithFrame:CGRectMake(190, 40, 70, 40)];
    self.rankLabel.backgroundColor = [UIColor clearColor];
    self.rankLabel.font = [UIFont systemFontOfSize:16];
    [self.rankLabel setTextColor:[UIColor lightGrayColor]];
    [self.scrollV addSubview:self.rankLabel];
    self.rankLabel.text = self.mySkill.level;
    [_rankLabel release];

    
    
    
    
    
    
    
    self.timeLabel1  = [[UILabel alloc] initWithFrame:CGRectMake(120, 70, 70, 40)];
    self.timeLabel1.backgroundColor = [UIColor clearColor];
    self.timeLabel1.text = @"冷却时间";
    self.timeLabel1.font = [UIFont systemFontOfSize:16];
    [self.timeLabel1 setTextColor:[UIColor lightGrayColor]];
    [self.scrollV addSubview:self.timeLabel1];
    [_timeLabel1 release];
    
    
    
    self.timeLabel  = [[UILabel alloc] initWithFrame:CGRectMake(190, 70, 70, 40)];
    self.timeLabel.backgroundColor = [UIColor clearColor];

    self.timeLabel.font = [UIFont systemFontOfSize:16];
    [self.timeLabel setTextColor:[UIColor lightGrayColor]];
    [self.scrollV addSubview:self.timeLabel];
    self.timeLabel.text = self.mySkill.cooldown;
    [_timeLabel release];
    
    
    
    
    
    self.describeLabel2  = [[UILabel alloc] initWithFrame:CGRectMake(10, 110, 70, 40)];
    self.describeLabel2.backgroundColor = [UIColor clearColor];
    self.describeLabel2.text = @"描述";
    self.describeLabel2.font = [UIFont systemFontOfSize:16];
    [self.describeLabel2 setTextColor:[UIColor lightGrayColor]];
    [self.scrollV addSubview:self.describeLabel2];
    [_describeLabel2 release];

    
    self.describeLabel  = [[UILabel alloc] initWithFrame:CGRectMake(10, 140, self.view.frame.size.width-20,40)];
    self.describeLabel.backgroundColor = [UIColor whiteColor];
    self.describeLabel.layer.masksToBounds =YES;
    self.describeLabel.layer.borderWidth = 1;
    self.describeLabel.layer.borderColor = [UIColor lightGrayColor].CGColor;
    self.describeLabel.numberOfLines = 0;
    self.describeLabel.text = self.mySkill.des;
    self.describeLabel.layer.cornerRadius = 10;
        self.describeLabel.font = [UIFont systemFontOfSize:16];
    [self.scrollV addSubview:self.describeLabel];
    [_describeLabel release];
 
    
    
    
    self.gistLabel2  = [[UILabel alloc] initWithFrame:CGRectMake(10, self.describeLabel.frame.origin.y + self.describeLabel.frame.size.height+20, 70, 40)];
    self.gistLabel2.backgroundColor = [UIColor clearColor];
    self.gistLabel2.text = @"提示";
    self.gistLabel2.font = [UIFont systemFontOfSize:16];
    [self.gistLabel2 setTextColor:[UIColor lightGrayColor]];
    [self.scrollV addSubview:self.gistLabel2];
    [_gistLabel2 release];
   
    
    
    self.gistLabel  = [[UILabel alloc] initWithFrame:CGRectMake(10, 140, self.view.frame.size.width-20,self.view.frame.size.width -20)];
    self.gistLabel.backgroundColor = [UIColor whiteColor];
    self.gistLabel.layer.masksToBounds =YES;
    self.gistLabel.layer.borderWidth = 1;
    self.gistLabel.layer.borderColor = [UIColor lightGrayColor].CGColor;
    self.gistLabel.numberOfLines = 0;
    self.gistLabel.text = self.mySkill.tips;
    self.gistLabel.layer.cornerRadius = 5;
    self.gistLabel.font = [UIFont systemFontOfSize:16];
  
    [self.scrollV addSubview:self.gistLabel];
    [_gistLabel release];
    
 
    CGFloat labelHight = [self  heightFor:self.describeLabel.text];
    CGRect frame = self.describeLabel.frame;
    frame.size.height = labelHight;
    self.describeLabel.frame = frame;

    
    self.gistLabel2.frame  = CGRectMake(10, self.describeLabel.frame.origin.y + self.describeLabel.frame.size.height+20, 70, 40);
    
    
    
    self.gistLabel.frame  = CGRectMake(10, self.gistLabel2.frame.origin.y + self.gistLabel2.frame.size.height+5, self.view.frame.size.width-20,80);
    
    
    
    CGFloat labelHight1 = [self  heightFor:self.gistLabel.text];
    CGRect frame1 = self.gistLabel.frame;
    frame1.size.height = labelHight1+10;
    self.gistLabel.frame = frame1;
    
    self. navigationItem.title = self.nameLabel.text;
    
}


-(void)action
{
    
    [self.navigationController popViewControllerAnimated:YES];
    
    
    
}
    
    
-(CGFloat)heightFor:(NSString *)content
{
    CGSize size = CGSizeMake(self.view.frame.size.width-20, 10000);
    NSDictionary *dic = [NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:16.0] forKey:NSFontAttributeName];
    CGRect frame = [content boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    
    return frame.size.height;
    
}

    
    
    
    
    
    
    



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
